<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        ul {
            display: flex;
            margin: 0;
            padding: 0;
            list-style: none;
            justify-content: space-between;
            flex-wrap: wrap;
            width: 1000px;
        }
        li {
            width: 240px;
            background-color: pink;
            height: 200px;
            margin-bottom: 20px;
        }

        li:last-child:nth-child(4n+2) {
            margin-right: calc((100% - 240px)/3*2);
        }
        li:last-child:nth-child(4n+3) {
            margin-right: calc((100% - 240px)/3*1);
        }
    </style>
</head>
<body>

    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>

    </ul>
    
</body>
</html>